<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>机构端</title>
        <script src="/Public/static/jquery-2.0.3.min.js"></script>
        <script src="/Public/static/layer/layer.js"></script>
        <link rel="stylesheet" href="__PUBLIC__/Home/css/reset.css">
        <link rel="stylesheet" href="__PUBLIC__/Home/css/style.css">
	</head>

	<body class="agency_box contentBox pos_rel dpflxr">
		<include file="head" />


		<!-- 2.垂直导航 -->
		<div class="navColumn">
			<a href="{:U('Mechanism/index')}" <if condition="$cur eq '信息设置'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='1'>
				<div class="lineColumn pos_abs"></div>
				<label for="">信息设置</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/department_manage')}" <if condition="$cur eq '部门管理'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='2'>
				<div class="lineColumn pos_abs"></div>
				<label for="">部门管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/staff')}" <if condition="$cur eq '员工管理'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='3'>
				<div class="lineColumn pos_abs"></div>
				<label for="">员工管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/role_manage')}" <if condition="$cur eq '权限管理'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='4'>
				<div class="lineColumn pos_abs"></div>
				<label for="">权限管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/punch_record')}" <if condition="$cur eq '打卡记录'">class="navColumnItem actived dpflxr pos_rel"<else/>class="navColumnItem dpflxr pos_rel"</if> data-type='5'>
				<div class="lineColumn pos_abs"></div>
				<label for="">打卡记录</label>
				<div class="rightArrow">
				</div>
			</a>
		</div>


		<!-- 3.垂直导航分类页面 -->
		<!-- 3.1 信息设置 -->
		<div class="contentArea tabPage actived">
			<div class="switchTab dpflxr">
				<a href="{:U('Mechanism/index')}" <if condition="$type eq 1"> class="switchItem dpflxc actived" <else />  class="switchItem dpflxc" </if>>
					<label for="">基本信息</label>
					<div class="tabLine"></div>
				</a>
				<a href="{:U('Mechanism/authentication_information')}" <if condition="$type eq 2"> class="switchItem dpflxc actived" <else />  class="switchItem dpflxc" </if>>
					<label for="">认证信息</label>
					<div class="tabLine"></div>
				</a>
				<a href="{:U('Mechanism/update_password')}" <if condition="$type eq 3"> class="switchItem dpflxc actived" <else />  class="switchItem dpflxc" </if>>
					<label for="">密码修改</label>
					<div class="tabLine"></div>
				</a>
			</div>

			

			<!-- 3.1.2 认证信息-->
			<div class="switchPage tabPageF dpflxr actived card">
				<div class="contentItem entry dpflxr">
					<label for="" class="title">机构全称：</label>
					<input type="text" name="full_name" value="{$info.full_name}" class="inputBox" placeholder="请输入机构名称"
						placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
				</div>
				<div class="contentItem entry dpflxr">
					<label for="" class="title">负责人：</label>
					<input type="text" class="inputBox" name="person_name" value="{$info.person_name}" placeholder="请输入负责人姓名"
						placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
				</div>
				<div class="contentItem entry dpflxr">
					<label for="" class="title">联系电话：</label>
					<input type="text" class="inputBox" name="person_mobile" value="{$info.person_mobile}" placeholder="请输入负责人联系方式"
						placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
				</div>
				<div class="contentItem entry dpflxr">
					<label for="" class="title">身份证号：</label>
					<input type="text" class="inputBox" name="id_number" value="{$info.id_number}" placeholder="请输入负责人身份证号码"
						placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
				</div>
				<div class="dpflxr">
					<div class="contentItem upload2 dpflxr">
						<label for="" class="title">身份证正面：</label>
						<div class="image pos_rel im" id="cc">
							<if condition="$info['id_card_z'] neq ''"><img src="{$info.id_card_z}"></if>
							<div class="icon pos_abs" >
								
							</div>

						</div>
					</div>
					<div class="contentItem upload2 dpflxr">
						<label for="" class="title">身份证反面：</label>
						<div class="image pos_rel im1" id="cc1">
							<if condition="$info['id_card_f'] neq ''"><img src="{$info.id_card_f}"></if>
							<div class="icon pos_abs">
								
							</div>
						</div>
					</div>
					<div class="contentItem upload2 dpflxr">
						<label for="" class="title">营业执照：</label>
						<div class="image pos_rel im2" id="cc2">
							<if condition="$info['business_license'] neq ''"><img src="{$info.business_license}"></if>
							<div class="icon pos_abs">
								
							</div>
						</div>
					</div>

				</div>
				<input type="hidden" name="id_card_z">
				<input type="hidden" name="id_card_f">
				<input type="hidden" name="business_license">
				<div class="ciBtn"><label>保存</label></div>

			</div>

			
		</div>
		
		

		
	</body>
</html>
<script type="text/javascript">
$("body").on('click','#cc',function(){
	// alert('123');
    var thisObj = $(this);
    var inputFile = document.createElement("input");
    inputFile.type = "file";
    inputFile.name = "file[]";
    inputFile.multiple = "multiple";
    inputFile.accept = "image/jpeg,image/jpg,image/png";
    inputFile.click();
    $(inputFile).change(function(){
        var files = inputFile.files;
        for(var i=0;i<files.length;i++){
            uploadImg(files[i],thisObj);
        }
    });
});
function uploadImg(file,thisObj){
    var formData = new FormData();
    formData.append('image', file);
    $.ajax({
        url: "{:U('Mechanism/uploadImg')}",
        type: "post",
        data: formData,
        dataType:"json",
        contentType: false,
        processData: false,
        mimeType: "multipart/form-data",
        success: function (data) {
            if(data.code == 0){
            　　console.log(data.info.imgid);
                var imgid=data.info.imgid;
            	$("input[name='id_card_z']").val(imgid);
            	var img=data.info.imgurl;
            	$('.im').html('<img src="'+img+'"/>');

　　　　　　　}
        },
    });
}

$("body").on('click','#cc1',function(){
    var thisObj = $(this);
    var inputFile = document.createElement("input");
    inputFile.type = "file";
    inputFile.name = "file[]";
    inputFile.multiple = "multiple";
    inputFile.accept = "image/jpeg,image/jpg,image/png";
    inputFile.click();
    $(inputFile).change(function(){
        var files = inputFile.files;
        for(var i=0;i<files.length;i++){
            uploadImg1(files[i],thisObj);
        }
    });
});
function uploadImg1(file,thisObj){
    var formData = new FormData();
    formData.append('image', file);
    $.ajax({
        url: "{:U('Mechanism/uploadImg')}",
        type: "post",
        data: formData,
        dataType:"json",
        contentType: false,
        processData: false,
        mimeType: "multipart/form-data",
        success: function (data) {
            if(data.code == 0){
            　　console.log(data.info.imgid);
                var imgid=data.info.imgid;
            	$("input[name='id_card_f']").val(imgid);
            	var img=data.info.imgurl;
            	$('.im1').html('<img src="'+img+'"/>');

　　　　　　　}
        },
    });
}


$("body").on('click','#cc2',function(){
    var thisObj = $(this);
    var inputFile = document.createElement("input");
    inputFile.type = "file";
    inputFile.name = "file[]";
    inputFile.multiple = "multiple";
    inputFile.accept = "image/jpeg,image/jpg,image/png";
    inputFile.click();
    $(inputFile).change(function(){
        var files = inputFile.files;
        for(var i=0;i<files.length;i++){
            uploadImg2(files[i],thisObj);
        }
    });
});
function uploadImg2(file,thisObj){
    var formData = new FormData();
    formData.append('image', file);
    $.ajax({
        url: "{:U('Mechanism/uploadImg')}",
        type: "post",
        data: formData,
        dataType:"json",
        contentType: false,
        processData: false,
        mimeType: "multipart/form-data",
        success: function (data) {
            if(data.code == 0){
            　　console.log(data.info.imgid);
                var imgid=data.info.imgid;
            	$("input[name='business_license']").val(imgid);
            	var img=data.info.imgurl;
            	$('.im2').html('<img src="'+img+'"/>');

　　　　　　　}
        },
    });
}


$("body").on('click','.ciBtn',function(){

	var full_name=$("input[name='full_name']").val();
	var person_name=$("input[name='person_name']").val();
	var person_mobile=$("input[name='person_mobile']").val();
	var id_number=$("input[name='id_number']").val();
	var id_card_f=$("input[name='id_card_f']").val();
	var id_card_z=$("input[name='id_card_z']").val();
	var business_license=$("input[name='business_license']").val();

	// alert(id_card_z);return false;
	$.ajax({
		url: "{:U('Mechanism/save_authentication')}",
        type: "post",
        data: {full_name:full_name,person_name:person_name,person_mobile:person_mobile,id_number:id_number,id_card_f:id_card_f,id_card_z:id_card_z,business_license:business_license},
        dataType:"json",
        success: function (data) {
            if(data.result == 1){
            　　alert('成功');
    			var url = "{:U('Mechanism/authentication_information')}";
                location.href=url;

　　　　　　　}else{
				alert('失败');
				var url = "{:U('Mechanism/authentication_information')}";
	            location.href=url;

			}
        },
	})
})
</script>